﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLK.Database;
using QLK.Database.DALs;
namespace QLK.Database.BLLs
{
    public class ImportInvoiceBLL
    {
        private ImportInvoiceDAL DAL;
        public ImportInvoiceBLL()
        {
            DAL = new ImportInvoiceDAL();
        }
        public ImportInvoice GetImportInvoiceByImportID(int importID)
        {
            if (importID > 0)
                return DAL.GetImportInvoiceByImportID(importID);
            return null;
        }
        public IEnumerable<ImportInvoice> GetAllImportInvoice()
        {
            return DAL.GetAllImportInvoice();
        }
        //public bool SearchImportInvoices(ImportInvoice import)
        //{
        //    return DAL.GetImportInvoiceAdvanced(import);
        //}
        public bool DeleteImportInvoiceByImportID(int importID)
        {
            return DAL.DeleteImportInvoiceByImportID(importID);
        }
        public bool UpdateImportInvoice(ImportInvoice import)
        {
            // check duplicate supplier
            if (!DAL.CheckDuplicateImportInvoiceByInvoiceID(import.InvoceID))
            {
                return DAL.UpdateImportInvoice(import);
            }
            return false;

        }
        public bool InsertImportInvoice(ImportInvoice import)
        {
            if (!DAL.CheckDuplicateImportInvoiceByInvoiceID(import.InvoceID))
            {
                return DAL.InsertImportInvoice(import);
            }
            return false;
        }
        public void DeleteImportInvoiceByImportID(ImportInvoice import)
        {
            throw new NotImplementedException();
        }
        //========
      
    }
}
